package com.byxy.service.impl;

import com.byxy.mapper.BlogMapper;
import com.byxy.mapper.BlogMapper;
import com.byxy.po.Blog;
import com.byxy.service.BlogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class BlogServiceImpl implements BlogService<Blog> {


    @Resource
    private BlogMapper blogMapper;

    @Override
    public int deleteByPrimaryKey(Blog key) {
        return blogMapper.deleteByPrimaryKey(key);
    }

    @Override
    public int insert(Blog record) {
        record.setShare(0);
        record.setViewed(0);
        record.setGiveLike(0);
        record.setPublTime(new Date());
        return blogMapper.insert(record);
    }

    @Override
    public int insertSelective(Blog record) {
        record.setShare(0);
        record.setViewed(0);
        record.setGiveLike(0);
        record.setPublTime(new Date());
        return blogMapper.insertSelective(record);
    }

    @Override
    public Blog selectOne(Blog record) {
        return blogMapper.selectOne(record);
    }

    @Override
    public int updateByPrimaryKey(Blog record) {
        return blogMapper.updateByPrimaryKey(record);
    }
}
